#ifndef __APP_MSG_H__
#define __APP_MSG_H__
#include "app_common.h"
#include "stdint.h"
#include "cJSON/cJSON.h"
#include "log/log.h"
typedef struct
{
    char *connetType;
    int motorId;
    char *action;
    int16_t motorSpeed;
    char *status;
} msg_t;

/**
* @brief 将msg转化为json格式的字符串数组
*
*/
Com_State app_msg_msgToJson(msg_t *msg , char *json);

/**
* @brief 将json格式的消息数据转换为 结构体格式s的 消息数据
*/
Com_State app_msg_jsonToMsg(char *json, msg_t *msg);

/*
设置电机速度:
    {
        "connType": "rs485",
        "motorId": 9,
        "action": "set",
        "motorSpeed": -1009
    }
获取电机速度:
    {
        "connType": "rs485",
        "motorId": 9,
        "action": "get"
    }
    返回电机速度:
    {
        "connType": "rs485",
        "motorId": 9,
        "action": "get",
        "motorSpeed": -1009,
        "status": "ok"   // ok or error
    }
*/

#endif /* __APP_MESSAGE_H__ */